Fixed issue with encoding for links.self
item
#225
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Jouke,
It's a follow up for already merged PR #206 . After we started to use paging, we found one issue with that old one PR. If initial query has parameters like
page[number]
, etc, then it WebApi might encode them and thenHttpRequestMessage.RequestUri
would have already encoded one, and thenlinks.self
would have encoded value.Here is what we are getting for endpoint that supports paging when we access such endpoint - https://localhost/WebService4/v5/internal/locations/marketplace?page[number]=2
Here is what i'm seeing in Visual Studio in the debugger. I'm not sure why it happens in that way as initial url it totally correct and doesn't have any encoding.
I pushed fix to use
_baseUrl.ToString()
so it won't do encoding there and port also won't be present. And added a couple of tests to validate it. The problem there is that in unit test it doesn't do that so it's hard to mimic that behavior and only way i was able to do it by specifying already encoded_baseUrl
inUrlConstructionTests.SelfLinkNoEncodingBasedOnEncoded
unit test.Thanks!